import React, { useEffect, useState, useRef } from 'react';
import { Tree, Row, Col, Card } from 'antd';
export default (props) => {
  const { list = [], selectedKeys = [], onCheck, hasCard = false } = props;
  if (hasCard) {
    return (
      <Row>
        <Col span={3}></Col>
        <Col span={20}>
          <Card title="功能权限">
            <Tree
              {...props}
              checkable
              onCheck={onCheck}
              checkedKeys={selectedKeys}
              treeData={list}
              fieldNames={{
                title: 'accessName',
                key: 'id',
                children: 'subRoleDetailAccessList',
              }}
            ></Tree>
          </Card>
        </Col>
      </Row>
    );
  } else {
    return (
      <Tree
        {...props}
        checkable
        onCheck={onCheck}
        checkedKeys={selectedKeys}
        treeData={list}
        fieldNames={{
          title: 'accessName',
          key: 'id',
          children: 'subRoleDetailAccessList',
        }}
      ></Tree>
    );
  }
};
